<?php


namespace backend\modules\tool\DataSource\Task\prcoess;


use Faker\Provider\Base;

abstract class BaseProcess
{
    protected $maxChildren;//最大执行进程数量
    public function __construct(int $maxChildren)
    {
        $this->maxChildren=$maxChildren;
    }

    /**
     * 添加任务
     * @param \Closure $closure
     * @return mixed
     */
    abstract function addTask(\Closure $closure);

    /**
     * 异常处理
     * @param \Throwable $throwable
     * @return mixed
     */
    abstract function ExceptionHandler(\Throwable $throwable);

    /**
     * 任务执行完毕
     * @return mixed
     */
    abstract function TaskEnd();

    /**
     * 开始执行任务
     * @return mixed
     */
    abstract function start();
}